﻿@model DFYE.Web.Models.student
@using JULONG.WEB.Library
@using DFYE.Web.Models;
@{
    ViewBag.Title = "Edit";
    List<studentClass> sc = ViewBag.studentClass as List<studentClass>;
}

<h2>编辑</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>学生档案</legend>
@*        <img src="" width="400" height="300" style=" position:absolute;left:620px" />
        <button style=" position:absolute;top:450px; left:760px"> upload</button>*@
        <div class="editor-label">
            姓名
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.name)
            @Html.ValidationMessageFor(model => model.name)
        </div>

        <div class="editor-label">
            性别
        </div>
        @{
    string nanstr = "";
    string nuestr = "";
    if (Model.sex)
    {
        nanstr = "selected='selected'";
    }
    else {
        nuestr = "selected='selected'";
    }
        }
        <div class="editor-field">
            <select name="sex">
                <option value="true" @nanstr>男</option>
                <option  value="false" @nuestr>女</option>
            </select>

@*           Html.DropDownListFor(model => model.sex)*@
            @Html.ValidationMessageFor(model => model.sex)
        </div>

        <div class="editor-label">
            生日
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.birthday)
            @Html.ValidationMessageFor(model => model.birthday)
        </div>

        <div class="editor-label">
            联系电话
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.tel)
            @Html.ValidationMessageFor(model => model.tel)
        </div>

        <div class="editor-label">
            家庭地址
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.address, new { @class = "normal" })
            @Html.ValidationMessageFor(model => model.address)
        </div>

        <div class="editor-label">
            家长信息
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.parents, new { @class = "normal" })
            @Html.ValidationMessageFor(model => model.parents)
        </div>

        <div class="editor-label">
            备注
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.exp, new { @class = "normal areaShort" })
            @Html.ValidationMessageFor(model => model.exp)
        </div>

        <div class="editor-label">
            建立时间
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.createDate)
            @Html.ValidationMessageFor(model => model.createDate)
        </div>
        <div class="editor-label">
            对外开放
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.isOpen)
            @Html.ValidationMessageFor(model => model.isOpen)
        </div>
        <div class="editor-label">
            访问密码
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.password)
            @Html.ValidationMessageFor(model => model.password)
            <button type="button" onclick="getNewPsw()">获取新密码</button>不区分大小写
        </div>


        <div class="editor-label">
            班级
        </div>
        <div class="editor-field">

            @Html.DropDownListFor(model => model.studentClassID, new SelectList(sc, "ID", "name"))
            @Html.ValidationMessageFor(model => model.studentClassID)
        </div>

        <div class="editor-label">
            内部资料
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.innerData, new { @class = "larg areaLarg" })
            @Html.ValidationMessageFor(model => model.innerData)
        </div>
        <div class="editor-label">
            有效
        </div>
        <div class="editor-field">
            @Html.CheckBoxFor(model => model.able)
        </div>
        <p>
            <input type="submit" value="保存" class="submitBtn"/>
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("返回列表", "Index")
</div>
<script>
    $("#createDate").attr("readonly", "true").datepicker();
    $("#birthday").attr("readonly", "true").datepicker();
    function getNewPsw() {
        $.post("/manage/student/getNewPsw", function (json) {
            $("#password").val(json.content).css("background-color", "red");
        });
    
    }
</script>